package designpatterns.abstractfactory;

import designpatterns.abstractfactory.intf.Color;
import designpatterns.abstractfactory.intf.Rectangle;
import designpatterns.abstractfactory.intf.Shape;
import designpatterns.abstractfactory.intf.Square;

/**
 * @description:
 * @author: Lidong
 * @time: 2020/7/21 21:40
 **/
public class ShapeFactory extends AbstractFactory {

    public static final String TYPE = "shape";

    @Override
    public Color getColor(String color) {
        return null;
    }

    @Override
    public Shape getShape(String shape) {
        if (shape == null) {
            return null;
        }
        if (Rectangle.SHAPE.equalsIgnoreCase(shape)) {
            return new Rectangle();
        } else if (Square.SHAPE.equalsIgnoreCase(shape)) {
            return new Square();
        }
        return null;
    }
}
